package com.pingan.stat.reposys.pahaoche.service;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.annotation.Resource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component;

import com.pingan.common.core.property.Properties;
import com.pingan.common.util.ShellExecutor;
import com.pingan.stat.service.StatService;

@Component
public class PAHaoChePVUVStatService implements StatService {

	@Properties(name = "reposys.pahaoche.output.path")
	private String pahaocheOutputPath;

	@Properties(name = "reposys.pahaoche.pv.uv")
	private String pahaochePVUVShell;

	@Resource
	private ShellExecutor shellExecutor;

	private static final Log log = LogFactory.getLog("hive");

	@Override
	public void dailyStat(Date date) {
		// TODO Auto-generated method stub
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
		String yyyyMMdd = sdf.format(date);
		String output = pahaocheOutputPath + "/" + yyyyMMdd;

		log.info("----------------->>>>>>>>>>>>>>>>>> stat pahaoche pv uv ip");
		String[] pvUVParam = new String[] { yyyyMMdd, output };
		shellExecutor.excecute(pahaochePVUVShell, pvUVParam);
	}

}
